-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send current state of the subscriptions #444
Send current state of the subscriptions #444
Conversation
3862819
to
5a199bb
Compare
It looks like the pubsub mod doesn't currently have access to the database so we would have to provide that? I'm happy with it in either place so if you think its worth refactoring to put it there I'm happy with that, I do see your point about making it agnostic, but if its much more complicated it may not be worht it? Looking at the current code it looks good my only concern is it looks like we will silently fail, granted on calls that really shouldnt fail, but in general I think its good to at least log errors if returning them is impractical as we don't want to stop the whole call failing for a partial failure. |
51a679b
to
43af4a0
Compare
crates/cdk/src/nuts/nut17/mod.rs
Outdated
@@ -9,6 +13,20 @@ use crate::{ | |||
}; | |||
use serde::{Deserialize, Serialize}; | |||
use std::ops::Deref; | |||
#[cfg(feature = "mint")] | |||
use std::sync::Arc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you reorder these imports to be consistent with the style guide.
https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md#order-of-imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better now @thesimplekid ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it here no need to hold up merging for that
Rebase on main will fix the ci issue |
I moved the logic to send the initial values to the subscriptions onto a generic trait implemented in nut17. The main goal is to have the same behavior regardless of whether the subscriptions come from web sockets or internally from other parts of the systems or other crates.
Add a no-op code handle for subscription creation when the crate is compiled without the mint feature
43af4a0
to
2c7cb80
Compare
Improve #394
Make WebSocket subscriptions send the current status when subscribing. It would also be interesting to implement this logic into the PubSub crate. If we do this, this solution would be agnostic to the WebSocket, and any other bit of the rust code that wants to subscribe would inherit messages of current status when they subscribe. What are your thoughts @thesimplekid ?